<template>
    <div>
      <input type="button" value="开始22" @click="begin">
      <!--<input type="button" value="停止" @click="stop">-->
     <div> {{msg}}
     </div>
    </div>
</template>

<script>
export default {
  name: 'runLight',
  data () {
    return {
      msg: '猥琐发育，别浪',
      // 定时器
      intervalId: null
    }
  },
  methods: {
    begin () {
      if (this.intervalId != null) return
      this.intervalId = setInterval(() => {
        var startFn = this.msg.substring(0, 1)
        var endFn = this.msg.substring(1)
        this.msg = endFn + startFn
      }, 500)
    }
    // stop () {
    //   clearInterval(this.intervalId)
    //   this.intervalId = null
    // }
  }
}
</script>

<style scoped>

</style>
